#ifndef IMEDIA_TRANSPORT_ENGINE_H_
#define IMEDIA_TRANSPORT_ENGINE_H_

#include "IHRTSAP2pEngine.h"
#include "IHRTSAEngine.h"
#include "IMediaTransportHandler.h"

#ifdef MTRANS_EXPORT
#ifdef CONTROL_WINDOWS
#define MTRANS_ENGINEAPI __declspec(dllexport)
#else
#define MTRANS_ENGINEAPI __attribute__((__visibility__("default")))
#endif
#else
#define MTRANS_ENGINEAPI
#endif

enum HRTSATransportMode {
    DEFAULT_MODE = 0,
    WEBRTC_0 = 1 << 0,
    UNITRANS_RELIABLE = 1 << 1,
    UNITRANS_UNRELIABLE = 1 << 2,
	MRIGHT = 1 << 3
};

namespace huawei {
namespace rtsap2p {

class IMediaTransportEngine
{
public:
	virtual ~IMediaTransportEngine() = default;
	virtual int login(const HRTSAP2pLoginParam& loginParam) = 0;
	virtual int logout() = 0;
	virtual int setInitConfig(const huawei::rtsa::HRTSAInitConfig& config) = 0;
	virtual int renewAuthorization(const char* token, long long ctime) = 0;
	virtual int destory() = 0;
    virtual int setAccessResourceType(char* resourceTags[], int num) = 0;
    virtual int setIntranetEnv(const huawei::rtsa::HRTSAIntranetParam & param) = 0;
    virtual int setNetworkBandwidth(const huawei::rtsa::HRTSANetworkBandwidth& bandwidthParam) = 0;
	virtual int setNetworkInterface(const huawei::rtsa::HRTSANicParam& param) = 0;
    virtual int setLocalProxyServer(const huawei::rtsa::HRTSAProxyParam &param) = 0;
	virtual int startLocalVideoStream() = 0;
	virtual int stopLocalVideoStream() = 0;
	virtual int startRemoteVideoStream() = 0;
	virtual int stopRemoteVideoStream() = 0;
	virtual int sendVideoFrameData(const unsigned char* frame, unsigned int length,
		const huawei::rtsa::HRTSAFrameVideoOption& option) = 0;
	virtual int requestKeyFrame() = 0;

	virtual int startLocalAudioStream() = 0;
	virtual int stopLocalAudioStream() = 0;
	virtual int startRemoteAudioStream() = 0;
	virtual int stopRemoteAudioStream() = 0;
	virtual int sendAudioFrameData(const unsigned char* frame, unsigned int length) = 0;
	virtual int sendCommandData(const char* userId, const unsigned char* data, unsigned int length) = 0;
	virtual int enableCommandMsg(bool enable) = 0;
};

} // namespace rtsap2p
} // namespace huawei

MTRANS_ENGINEAPI unsigned int getTransportMode();

MTRANS_ENGINEAPI huawei::rtsap2p::IMediaTransportEngine* createMediaTransportEngine(
	huawei::rtsa::HRTSACreateParam* createParam,
	huawei::rtsap2p::IMediaTransportEventHandler* eventHandler);

MTRANS_ENGINEAPI huawei::rtsa::IHRTSAEngine* createMediaTransportHRTSAEngine(huawei::rtsa::HRTSACreateParam* createParam,
	huawei::rtsa::IHRTSAEventHandler* rtsaEventHandler);

#endif // IMEDIA_TRANSPORT_ENGINE_H_